<%@page import="com.mto.module.karaoke.service.CategoryLocalServiceUtil"%>
<%@ include file="/jsps/main.jsp"%>

<aui:form action="<%=renderResponse.createRenderURL() %>">
	<aui:layout cssClass="portlet-layout">
		<aui:column cssClass="aui-w20 portlet-column portlet-column-first">
			<div class="portlet-column-content portlet-column-content-first">
				<ul class="karaoke-menu">
					<portlet:renderURL var="addUrl">
						<portlet:param name="jspPage" value="/jsps/quan-tri/category/update.jsp" />
						<portlet:param name="tab" value="quan-tri-danh-muc" />
					</portlet:renderURL>
					<li><a href="<%=addUrl%>"><liferay-ui:message key="tao-danh-muc"/></a></li>
				</ul>
			</div>
	
		</aui:column>
		<aui:column cssClass="aui-w80 portlet-column portlet-column-last">
			<div class="portlet-column-content portlet-column-content-last">
				<%
				PortletURL renderUrl = renderResponse.createRenderURL();
				renderUrl.setParameter("tab", "quan-tri-danh-muc");
				PortletURL redirectUrl = renderResponse.createRenderURL();
				PortletURL actionUrl = renderResponse.createActionURL();
				%>
				<div id="karaoke-list">
				<liferay-ui:search-container emptyResultsMessage="no-category-found" delta="<%=10 %>">
					<liferay-ui:search-container-results>
						<%
						results = CategoryLocalServiceUtil.getCategories(searchContainer.getStart(), searchContainer.getEnd());
						total = CategoryLocalServiceUtil.getCategoriesCount();
						pageContext.setAttribute("results", results);
						pageContext.setAttribute("total", total);
						%>
					</liferay-ui:search-container-results>
					
					<liferay-ui:search-container-row className="com.mto.module.karaoke.model.Category" modelVar="category" keyProperty="categoryId">
						<%
						String categoryId = String.valueOf(category.getCategoryId());
						renderUrl.setParameter("categoryId", categoryId);
						actionUrl.setParameter("categoryId", categoryId);
						%>
						<liferay-ui:search-container-column-text name='categoryId' value="<%= categoryId %>" align="center" orderable="<%=true %>" />
						<liferay-ui:search-container-column-text name='name' />
						<liferay-ui:search-container-column-text align="center" cssClass="w-75px">
							<liferay-ui:icon-menu message="" cssClass="float-none" >
								<%
								renderUrl.setParameter("jspPage", "/jsps/quan-tri/category/update.jsp");
								%>
								<liferay-ui:icon image="edit" url="<%=renderUrl.toString() %>" />
								<%
								actionUrl.setParameter("redirectUrl", redirectUrl.toString());
								actionUrl.setParameter(ActionRequest.ACTION_NAME, "deleteSong");
								%>
								<liferay-ui:icon image="delete" url="<%=actionUrl.toString() %>" />
							</liferay-ui:icon-menu>
						</liferay-ui:search-container-column-text>
					</liferay-ui:search-container-row>
					<liferay-ui:search-iterator />
				</liferay-ui:search-container>
				</div>
			</div>
		</aui:column>
	</aui:layout>
</aui:form>